package com.yd.sdk.analysisadjust;

import android.app.Activity;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;

import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustAdRevenue;
import com.adjust.sdk.AdjustConfig;
import com.adjust.sdk.LogLevel;
import com.yd.sdk.analysis.AnalysisAbstractClass;

public class AnalysisAdjustImp extends AnalysisAbstractClass {

    @Override
    public void onCreate(Activity activity, Bundle savedInstanceState) {
        id = "Adjust";
        this.activity = activity;
        ApplicationInfo appInfo= null;
        try {
            appInfo = activity.getPackageManager()
                    .getApplicationInfo(activity.getPackageName(),
                            PackageManager.GET_META_DATA);
            String msg=appInfo.metaData.getString("data_Name");
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

        if(appInfo != null)
        {
            String adjust_id = appInfo.metaData.getString("adjust_id");
            String environment = AdjustConfig.ENVIRONMENT_PRODUCTION;
            AdjustConfig config = new AdjustConfig(activity, adjust_id, environment);
            config.setLogLevel(LogLevel.DEBUG);
            Adjust.onCreate(config);
        }
    }

    @Override
    public void onPause() {
        Adjust.onPause();
    }

    @Override
    public void onResume() {
        Adjust.onResume();
    }

    @Override
    public void onDestroy() {

    }

    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantRes) {

    }

    @Override
    public void Initialize(String key) {
//        String environment = AdjustConfig.ENVIRONMENT_PRODUCTION;
//        AdjustConfig config = new AdjustConfig(activity, key, environment);
//        config.setLogLevel(LogLevel.DEBUG);
//        Adjust.onCreate(config);
    }

    @Override
    public void LogEvent(String name, String key, String message) {

    }
}
